﻿<nav class="menu">
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="list-separator nav navbar-nav well well-primary ">
            @code
            {
                public class SiteData
                {
                    public SiteData(string text, string url, string icon, string layout = "", string target = "")
                    {
                        Text = text;
                        Url = url;
                        Icon = icon;
                        Layout = layout;
                        Target = target;
                    }

                    public string Text { get; set; }
                    public string Url { get; set; }
                    public string Icon { get; set; }
                    public string Layout { get; set; }
                    public string Target { get; set; }
                }

                public SiteData[] SiteDataList { get; } = new[]
                {
                    new SiteData("博客", "/", "fa-book", "post"),
                    new SiteData("归档","/mind","fa-commenting"),
                    new SiteData("朋友","/friends","fa-group"),
                    new SiteData("关于","/about","fa-info"),
                    new SiteData("RSS 订阅","/feed.xml","fa-feed",target:"_blank"),
                };

            }

            @foreach (var siteData in SiteDataList)
            {
                <li class="col-lg-12 col-md-12 col-sm-4 col-xs-12">
                    <a href="@siteData.Url"
                       target="@siteData.Target">
                        <i class="fa @siteData.Icon"></i>
                        @siteData.Text
                    </a>
                </li>
            }

            @*{% for i in site.data.urls %}
                {% assign current = nil %}
                {% assign pageurl = page.url | split:'/' | last %}
                {% assign menuurl = i.url | split:'/' | last %}
                {% assign linkurl = nil %}
                {% if i.url contains '://' %}
                {% assign linkurl = i.url %}
                {% else %}
                {% assign linkurl = i.url | prepend: site.baseurl %}
                {% endif %}
                {% assign target = i.target %}
                {% unless target %} {% assign target = '_self' %} {% endunless %}
                {% if pageurl == menuurl or page.layout == i.layout %} {% assign current = 'current-menu-item' %} {% endif %}
                <li class="col-lg-12 col-md-12 col-sm-4 col-xs-12 {{ current }} {{ pageurl }}"><a href="{{ linkurl }}" target="{{ target }}"><i class="fa {{ i.icon }}"></i> {{ i.text }}</a></li>
                {% endfor %}*@
        </ul>

    </div>
</nav>